package routes

import (
	"github.com/iris-contrib/middleware/cors"
	 "github.com/irisProject/app/controllers/api"
	"github.com/irisProject/bootstrap"
	"github.com/kataras/iris"
	"github.com/kataras/iris/mvc"
)

var (
	crs = cors.New(cors.Options{
		AllowedOrigins:   []string{"*"}, // allows everything, use that to change the hosts.
		AllowedMethods:   []string{"PUT", "PATCH", "GET", "POST", "OPTIONS", "DELETE"},
		AllowedHeaders:   []string{"*"},
		ExposedHeaders:   []string{"Accept", "Content-Type", "Content-Length", "Accept-Encoding", "X-CSRF-Token", "Authorization"},
		AllowCredentials: true,
	})
)

func ApiRoutes(app *bootstrap.App) {
	v1 := mvc.New(app.Party("/api/v1", crs).AllowMethods(iris.MethodOptions))

	index := v1.Party("/index")
	index.Handle(new(api.IndexController))


}
